from django.shortcuts import render

# Create your views here.
from rest_framework import viewsets
from rest_framework.pagination import PageNumberPagination

from contents.models import ContentCategory
from contents.serializers import ContentCategorySerializer


class NoPageNum(PageNumberPagination):
    page_size_query_param = 'page_size'
    page_size = 1000


class ContentCategoryViewSet(viewsets.ModelViewSet):
    """
    完成产品的增删改查
    """
    queryset = ContentCategory.objects.all() # 视图集默认定义了数据,
    serializer_class = ContentCategorySerializer  # 优先使用 get_serializer_class 返回的序列化器

    pagination_class = NoPageNum
